﻿package frEngine.loaders.away3dMd5
{
    import __AS3__.vec.*;
    import flash.utils.*;

    public class SkeletonAnimationSet extends Object
    {
        private var _animations:Vector.<SkeletonClipNode>;
        private var _animationNames:Array;
        private var _animationDictionary:Dictionary;
        private var _jointsPerVertex:uint;

        public function SkeletonAnimationSet()
        {
            this._animations = new Vector.<SkeletonClipNode>;
            this._animationNames = new Array();
            this._animationDictionary = new Dictionary(false);
            return;
        }// end function

        public function get jointsPerVertex() : uint
        {
            return this._jointsPerVertex;
        }// end function

        public function get animations() : Vector.<SkeletonClipNode>
        {
            return this._animations;
        }// end function

        public function dispose() : void
        {
            var _loc_1:SkeletonClipNode = null;
            for each (_loc_1 in this._animationDictionary)
            {
                
                _loc_1.dispose();
            }
            this._animationDictionary = new Dictionary(false);
            return;
        }// end function

        public function get animationNames() : Array
        {
            return this._animationNames;
        }// end function

        public function getSubClipNode(param1:String) : SkeletonClipNode
        {
            var _loc_2:SkeletonClipNode = null;
            for each (_loc_2 in this._animationDictionary)
            {
                
                if (_loc_2.trackName == param1)
                {
                    return _loc_2;
                }
            }
            return null;
        }// end function

        public function init(param1:Vector.<SkeletonClipNode>) : void
        {
            var _loc_4:SkeletonClipNode = null;
            this._animations = param1;
            var _loc_2:* = param1.length;
            var _loc_3:int = 0;
            while (_loc_3 < _loc_2)
            {
                
                _loc_4 = param1[_loc_3];
                if (this._animationDictionary[_loc_4.trackName])
                {
                    throw new Error("root node name \'" + _loc_4.trackName + "\' already exists in the set");
                }
                this._animationDictionary[_loc_4.trackName] = _loc_4;
                this._animationNames.push(_loc_4.trackName);
                _loc_3++;
            }
            return;
        }// end function

        public function hasAnimation(param1:String) : Boolean
        {
            return this._animationDictionary[param1] != null;
        }// end function

        public function getAnimation(param1:String) : SkeletonClipNode
        {
            return this._animationDictionary[param1];
        }// end function

    }
}
